home *** CD-ROM | disk | FTP | other *** search
- // Figure 8 for "A Little CAD with C++"
- // Copyright 1988 Bruce Eckel
- // Permission required to distribute source
-
- // file: square.cpp
- #include "square.hpp"
- #include <fg.h>
-
- void square::draw() {
- msm_hidecursor();
- small_box [FG_X1] = x_center;
- small_box [FG_X2] = x_center + 20;
- small_box [FG_Y1] = y_center;
- small_box [FG_Y2] = y_center + 20;
- fg_drawbox (FG_WHITE, FG_MODE_SET, ~0,
- FG_LINE_SOLID,
- small_box, fg_displaybox);
- msm_showcursor();
- }
-
- void square::erase() {
- msm_hidecursor();
- fg_drawbox (FG_BLACK, FG_MODE_SET, ~0,
- FG_LINE_SOLID, small_box, fg_displaybox);
- msm_showcursor();
- }
-